package com.blb.edupayservice.feign;

import com.blb.common.entity.Course;
import com.blb.common.entity.CourseActivity;
import com.blb.common.util.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient("edu-course-service")
public interface CourseServiceFeignClient {

    /**
     * 给活动库存加1
     * @param activityId
     * @return
     */
    @RequestMapping("/course-activity/addStock")
    ResponseResult<CourseActivity> addStock(@RequestParam Integer activityId,
                                                   @RequestParam(required = false,defaultValue = "1") Integer stock);

    /**
     * 给活动库存减1
     * @param activityId
     * @return
     */
    @RequestMapping("/course-activity/reduceStock")
    ResponseResult<CourseActivity> reduceStock(@RequestParam Integer activityId,
                                                      @RequestParam(required = false,defaultValue = "1")Integer stock);

    /**
     * 修改课程销量
     * @param id
     * @param sales
     * @return
     */
    @RequestMapping("/course/sales")
    Course addCourseSales(@RequestParam Long id,
                                 @RequestParam(required = false,defaultValue = "1") Integer sales);
}
